<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page session="true" import="java.util.Vector, ebookshop.Book" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <style type="text/css">
    body {background-color:lightblue; font-size=10pt;}
    H1 {font-size:20pt;}
    table {background-color:white;}
  </style>
  <title>E-Bookshop Checkout</title>
</head>
<body>
  <H1>Your online Bookshop - Checkout</H1>
  <hr/><p/>
  <table border="1" cellpadding="2">
    <tr>
      <td>TITLE</td>
      <td align="right">PRICE</td>
      <td align="right">QUANTITY</td>
    </tr>
<%
    Vector<Book> shoplist =
        (Vector<Book>)session.getAttribute("ebookshop.cart");
    for (Book anOrder : shoplist) {
%>
      <tr>
        <td><%=anOrder.getTitle()%></td>
        <td align="right">$<%=anOrder.getPrice()%></td>
        <td align="right"><%=anOrder.getQuantity()%></td>
      </tr>
<%
    }
    session.invalidate();
%>
    <tr>
      <td>TOTALS</td>
      <td align="right">$<%=(String)request.getAttribute("dollars")%></td>
      <td align="right"><%=(String)request.getAttribute("books")%></td>
    </tr>
  </table>
  <p/>
  <a href="/eshop">Buy more!</a>
</body>
</html>